import React,{ useState } from "react"
import Funchild from "./funcChild"

// 函数式父组件
const Funcpar = (props) => {
  const [message,setMessage] = useState('来自父亲组件')

  const sendMessageToChild = (newMessage)=>{
    setMessage(newMessage)
  }

  return (
    <div>
      <h2>函数式——父组件</h2>
      <p>获取调用时候传入的数据 {props.name}</p>
      <Funchild receiveMessage={message} postMessage={sendMessageToChild}/>
      <hr />
    </div>
  )
}

export default Funcpar